<template>
  <div class="selectedHotSongs">
    <div class="selectedSongs">
      <div class="selectedSongs-title">
        <h3>精选歌单</h3>
        <div class="more">
          <router-link to="/songSheet">更多 ></router-link>
        </div>
      </div>
      <div class="selectedSongs-content">
        <!-- 精选歌单内容部分的左边 -->
        <div class="selectedSongs-left">
          <div class="selectedSongs_img_wrapper">
            <img src="./images/jx.jpg" alt="" />
            <div class="mask">
              <div class="stop_btn"></div>
            </div>
            <div class="playCount">
              <img class="playCount_btn" src="./images/jx7.png" alt="" />
              <span>1113.4万</span>
            </div>
          </div>
          <div class="title">乡村之旅: 安静惬意·与自然同在</div>
        </div>
        <!-- 精选歌单内容部分的右边 -->
        <div class="selectedSongs-right">
          <div class="selectorSongs-right-items">
            <div class="selectorSongs_img_wrapper">
              <img src="./images/jx2.jpg" alt="" />
              <div class="mask">
                <div class="stop_btn"></div>
              </div>
              <div class="playCount">
                <i class="playCount_btn"></i>
                <span>1113.4万</span>
              </div>
            </div>
            <div class="title">青春回忆杀·80后的卡带故事</div>
          </div>
          <div class="selectorSongs-right-items">
            <div class="selectorSongs_img_wrapper">
              <img src="./images/jx3.jpg" alt="" />
              <div class="mask">
                <div class="stop_btn"></div>
              </div>
              <div class="playCount">
                <i class="playCount_btn"></i>
                <span>1113.4万</span>
              </div>
            </div>
            <div class="title">披荆斩棘的哥哥 合辑</div>
          </div>
          <div class="selectorSongs-right-items">
            <div class="selectorSongs_img_wrapper">
              <img src="./images/jx4.jpg" alt="" />
              <div class="mask">
                <div class="stop_btn"></div>
              </div>
              <div class="playCount">
                <i class="playCount_btn"></i>
                <span>1113.4万</span>
              </div>
            </div>
            <div class="title">丹心赋：望九州风月，祈万世长安</div>
          </div>
          <div class="selectorSongs-right-items">
            <div class="selectorSongs_img_wrapper">
              <img src="./images/jx5.jpg" alt="" />
              <div class="mask">
                <div class="stop_btn"></div>
              </div>
              <div class="playCount">
                <i class="playCount_btn"></i>
                <span>1113.4万</span>
              </div>
            </div>
            <div class="title">巅峰ing-TA们创造着欧美乐坛新荣耀</div>
          </div>
        </div>
      </div>
    </div>
    <div class="HotSongs">
      <div class="HotSongs-title">
        <h3>热门榜单</h3>
        <div class="more">
          <router-link to="/rankList">更多></router-link>
        </div>
      </div>
      <div class="HotSongs-content" @click="goMusicPlayer">
        <a class="HotSongs-content-items">
          <div class="top">
            <img src="./images/hot1.png" alt="" />
            <div class="mask">
              <div class="stop_btn"></div>
            </div>
          </div>
          <ul class="top-list">
            <li v-for="(item, index) in list1.songinfo" :key="index">
              <i>{{ index + 1 }}.</i> {{ item.songname }}
            </li>
          </ul>
        </a>
        <a class="HotSongs-content-items">
          <div class="top">
            <img src="./images/hot2.png" alt="" />
            <div class="mask">
              <div class="stop_btn"></div>
            </div>
          </div>
          <ul class="top-list">
            <li v-for="(item, index) in list2.songinfo" :key="index">
              <i>{{ index + 1 }}.</i> {{ item.songname }}
            </li>
          </ul>
        </a>
        <a class="HotSongs-content-items">
          <div class="top">
            <img src="./images/hot3.png" alt="" />
            <div class="mask">
              <div class="stop_btn"></div>
            </div>
          </div>
          <ul class="top-list">
            <li v-for="(item, index) in list3.songinfo" :key="index">
              <i>{{ index + 1 }}.</i> {{ item.songname }}
            </li>
          </ul>
        </a>
      </div>
    </div>
  </div>
</template>

<script>
import { reqRankingList } from "@/api";

export default {
  name: "SelectedSongs",
  data() {
    return {
      list1: [],
      list2: [],
      list3: [],
    };
  },
  mounted() {
    this.getListData();
  },
  methods: {
    async getListData() {
      let result = await reqRankingList();
      this.list1 = result.rank.list.slice(1, 2).map((item) => {
        return {
          songinfo: item.songinfo,
        };
      })[0];
      this.list2 = result.rank.list.slice(0, 1).map((item) => {
        return {
          songinfo: item.songinfo,
        };
      })[0];
      this.list3 = result.rank.list.slice(3, 4).map((item) => {
        return {
          songinfo: item.songinfo,
        };
      })[0];
    },
    goMusicPlayer() {
      this.$router.push({
        name: "MusicPlayer",
      });
    },
  },
};
</script>

<style lang="less" scoped>
.selectedHotSongs {
  width: 1000px;
  height: 492px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
}

.selectedSongs {
  width: 640px;
}

.selectedSongs-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  margin-top: 60px;
  height: 50px;
}

.selectedSongs-title h3 {
  font-size: 25px;
  font-weight: normal;
  color: #000000;
}

.selectedSongs .selectedSongs-title .more {
  color: #858585;
  font-size: 14px;
  font-weight: normal;
}

.selectedSongs .selectedSongs-title .more:hover {
  color: #0badff;
}

.selectedSongs-content {
  width: 640px;
  height: 362px;
  display: flex;
  justify-content: space-between;
}

.selectedSongs-left {
  width: 320px;
}

.selectedSongs-right {
  width: 290px;
}

.selectedSongs_img_wrapper {
  position: relative;
  width: 320px;
  height: 320px;
  overflow: hidden;
  cursor: pointer;
}

.selectedSongs_img_wrapper img {
  width: 100%;
  height: 100%;
  cursor: pointer;
  transition: all 0.3s;
}

.selectedSongs_img_wrapper:hover img {
  transform: scale(1.05);
}

.selectedSongs_img_wrapper:hover .mask {
  display: block;
}

.selectedSongs_img_wrapper .mask {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  width: 320px;
  height: 320px;
  background-color: rgba(0, 0, 0, 0.4);
  border-radius: 10px;
}

.mask .stop_btn {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 50px;
  height: 50px;
  transform: translate(-50%, -50%);
  background: url(./images/jx7.png) no-repeat;
  background-size: 100%;
  opacity: 0.9;
}

.selectedSongs-left .title {
  font-size: 14px;
  font-weight: 400;
  color: #000000;
  height: 40px;
  margin-top: 6px;
  word-break: break-all;
  cursor: pointer;
}

.selectedSongs-left .playCount {
  display: flex;
  justify-content: center;
  align-items: center;
  position: absolute;
  width: 70px;
  height: 24px;
  right: 0;
  bottom: 0;
  color: #fff;
  background: rgba(166, 165, 28, 0.6);
  border-radius: 15px;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

.selectedSongs-left .playCount_btn {
  width: 15px;
  height: 15px;
}

.selectedSongs-right {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
}

.selectorSongs-right-items {
  position: relative;
  width: 145px;
  height: 176px;
  border-radius: 10px;
  overflow: hidden;
}

.selectorSongs-right-items .selectorSongs_img_wrapper {
  width: 130px;
  height: 130px;
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
}

.selectorSongs_img_wrapper img {
  width: 130px;
  height: 130px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s;
}

.selectorSongs_img_wrapper:hover img {
  transform: scale(1.05);
}

.selectorSongs_img_wrapper:hover .mask {
  display: block;
}

.selectorSongs_img_wrapper .mask {
  display: none;
  position: absolute;
  width: 130px;
  height: 130px;
  left: 0;
  top: 0;
  background-color: rgba(0, 0, 0, 0.4);
  border-radius: 10px;
}

.selectorSongs-right-items .mask img {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 50px;
  height: 50px;
  cursor: pointer;
  transition: all 0.6s;
  border-radius: 10px;
}

.selectorSongs-right-items .mask img:hover {
  transform: scale(1.4);
}

.selectorSongs-right-items .playCount {
  display: flex;
  justify-content: center;
  align-items: center;
  position: absolute;
  width: 70px;
  height: 24px;
  right: 16px;
  bottom: 47px;
  color: #fff;
  border-radius: 15px;
  background-color: rgba(0, 0, 0, 0.2);
}

.selectorSongs-right-items .title {
  font-size: 14px;
  font-weight: 400;
  color: #000000;
  display: block;
  height: 40px;
  margin-top: 6px;
  word-break: break-all;
  overflow: hidden;
  -o-text-overflow: ellipsis;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  cursor: pointer;
}

.HotSongs {
  width: 320px;
  height: 492px;
}

.selectedSongs-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  margin-top: 60px;
  height: 50px;
  cursor: pointer;
}

.selectedSongs-title h3 {
  font-size: 25px;
  font-weight: normal;
  color: #000000;
}

.selectedSongs-title .more {
  color: #858585;
  font-size: 14px;
  font-weight: normal;
}

.selectedSongs-title .more:hover {
  color: #0badff;
}

.HotSongs {
  width: 320px;
  height: 492px;
}

.HotSongs-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  margin-top: 60px;
  height: 50px;
}

.HotSongs-title h3 {
  font-size: 25px;
  font-weight: normal;
  color: #000000;
}

.HotSongs-title .more {
  color: #858585;
  font-size: 14px;
  font-weight: normal;
  cursor: pointer;
}

.HotSongs .HotSongs-title .more:hover {
  color: #0badff;
}

.HotSongs-content {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  width: 320px;
  height: 362px;
}

.HotSongs-content-items {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 320px;
  height: 110px;
  background-color: #fcfcfc;
}

.HotSongs-content-items .top {
  position: relative;
  width: 110px;
  height: 110px;
  overflow: hidden;
  border-radius: 10px;
  cursor: pointer;
}

.HotSongs-content-items .top img {
  width: 100%;
  height: 100%;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s;
}

.HotSongs-content-items .top:hover img {
  transform: scale(1.05);
}

.HotSongs-content-items .top .mask {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.4);
}

.HotSongs-content-items .top:hover .mask {
  display: block;
}

.HotSongs-content-items .top-list {
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: 186px;
  height: 110px;
  margin-left: 24px;
  box-sizing: border-box;
  cursor: pointer;
}

.HotSongs-content-items .top-list li {
  width: 168px;
  color: #000;
  font-size: 14px;
  margin-top: 5px;
  word-break: break-all;
  overflow: hidden;
  -o-text-overflow: ellipsis;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
}

.top-list li i {
  font-weight: 700;
  margin-right: 2px;
}
</style>
